package com.Studen.util;

import com.alibaba.druid.pool.DruidDataSourceFactory;

import javax.sql.DataSource;
import java.io.FileInputStream;
import java.sql.Connection;
import java.util.Properties;

public class Jdbc {
        Connection connection=null;
        public Connection Get(){
            Properties properties = new Properties();
            try {
                //加载配置文件
                properties.load(new FileInputStream("D:/demo/StudensScore/src/main/java/druid.properties"));
                DataSource dataSource1 = DruidDataSourceFactory.createDataSource(properties);
                connection = dataSource1.getConnection();
            } catch (Exception e) {
                e.printStackTrace();
            }
            return connection;
        }
}
